package czk.concrent.juc.futuretask;

import java.util.concurrent.*;

/**
 * @Author:ChenZhangKun
 * @Date: 2023/3/29 21:06
 */
public class FutureTaskDemo {
    public static final ExecutorService executor= Executors.newCachedThreadPool();
    public static void main(String[] args) throws ExecutionException, InterruptedException {

        FutureTask<String> futureTask=new FutureTask<>(() -> "a");

        // 执行
        executor.submit(futureTask);

        // 拿到返回的·1值
        System.out.println(futureTask.get());


    }



}
